{extend name='main'}

{block name="button"}
<!--{if auth("config")}-->
<button data-modal='{:url("config")}' data-title="积分配置" class='layui-btn layui-btn-sm layui-btn-primary'>积分配置</button>
<!--{/if}-->
{/block}

{block name="content"}
<div class="layui-tab layui-tab-card think-bg-white">
    <div class="layui-tab-content think-box-shadow">
        <fieldset>

            <legend>条件搜索</legend>

            <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">

                <div class="layui-form-item layui-inline">
                    <label class="layui-form-label">用户账号</label>
                    <div class="layui-input-inline">
                        <input name="username" value="{:input('get.username')}" placeholder="请输入用户名" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item layui-inline">
                    <label class="layui-form-label">积分来源</label>
                    <div class="layui-input-inline">
                        <select class="layui-select" name="come_from">
                            {foreach $credits_from as $k=>$v}
                            {if input('get.come_from') eq $k.""}
                            <option selected value="{$k}">{$v}</option>
                            {else}
                            <option value="{$k}">{$v}</option>
                            {/if}
                            {/foreach}
                        </select>
                    </div>
                </div>

                <div class="layui-form-item layui-inline">
                    <label class="layui-form-label">积分类型</label>
                    <div class="layui-input-inline">
                        <select class="layui-select" name="credits_type">
                            {foreach $credits_type as $k=>$v}
                            {if input('get.credits_type') eq $k.""}
                            <option selected value="{$k}">{$v}</option>
                            {else}
                            <option value="{$k}">{$v}</option>
                            {/if}
                            {/foreach}
                        </select>
                    </div>
                </div>

                <div class="layui-form-item layui-inline">
                    <label class="layui-form-label">创建时间</label>
                    <div class="layui-input-inline">
                        <input data-date-range name="create_at" value="{:input('get.create_at')}" placeholder="请选择创建时间" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item layui-inline">
                    <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
                </div>
            </form>
        </fieldset>

        <table class="layui-table margin-top-10" lay-skin="line">
            {notempty name='list'}
            <thead>
            <tr>
                <th class='text-left nowrap' width="180px">用户名</th>
                <th class='text-left nowrap' width="150px">积分值</th>
                <th class='text-left nowrap' width="150px">来源</th>
                <th>积分类型</th>
                <th>时间</th>
            </tr>
            </thead>
            {/notempty}
            <tbody>
            {foreach $list as $key=>$vo}
            <tr>
                <td class='text-left nowrap'>
                    {$vo.username}
                </td>
                <td class='text-left nowrap'>
                    {$vo.credits}
                </td>
                <td class='text-left nowrap'>
                    {$credits_from[$vo.come_from]}
                </td>
                <td class='text-left nowrap'>
                    {$credits_type[$vo.credits_type]}
                </td>
                <td class='text-left nowrap'>
                    {$vo.create_at|format_datetime}
                </td>
            </tr>
            {/foreach}
            </tbody>
        </table>
        {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
    </div>
</div>
{/block}

{block name="script"}
<script>form.render()</script>
{/block}
